# 多态
class Animal(object):
    def shout(self):
        print("动物叫")


class Cat(Animal):
    def shout(self):
        print("喵喵喵")


class Dog(Animal):
    def shout(self):
        print("汪汪汪")


cat = Cat()
cat.shout()
dog = Dog()
dog.shout()


class Animal(object):
    def eat(self):
        print("吃东西")


class Pig(Animal):
    def eat(self):
        print("吃猪饲料")


class Dog(Animal):
    def eat(self):
        print("吃狗粮")


def test(obj):
    obj.eat()


animal = Animal()
test(animal)
pig = Pig()
test(pig)
dog = Dog()
test(dog)

